{include file="public_head"}
{include file="public_menu"}

  <div class="content_center">
    <div class="main_center">
      {include file="public_information_menu"}
      <div class="main_right right">
        <div class="order_content">
          <div class="tablist">
            <ul>
              <li {eq name=":input('status')" value="" }class="active"{/eq}><a href="{:url('MemberOrder/index')}">全部订单</a></li>
              <li {eq name=":input('status')" value="w" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>'w'])}">待付款</a></li>
              <li {eq name=":input('status')" value="1" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>1])}">待发货</a></li>
              <li {eq name=":input('status')" value="2" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>2])}">待收货</a></li>
              <li {eq name=":input('status')" value="3" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>3])}">已收货</a></li>
              <li {eq name=":input('status')" value="4" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>4])}">已完结</a></li>
              <li {eq name=":input('status')" value="6,7" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>'6,7'])}">申请退款/退货</a></li>
              <li {eq name=":input('status')" value="9" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>9])}">退货中</a></li>
              <li {eq name=":input('status')" value="10" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>10])}">退货\退款成功</a></li>
              <li {eq name=":input('status')" value="11" }class="active"{/eq}><a href="{:url('MemberOrder/index',['status'=>11])}">退货\退款失败</a></li>
              <li {eq name=":input('status')" value="auction" }class="active"{/eq}><a href="{:url('MemberOrder/auction',['status'=>'auction'])}">拍卖订单</a></li>
            </ul>
            <div class="search right">
              <input type="search" id="order_name" placeholder="订单号"><label><img src="__STATIC__/img/icon70.png" onclick="search_order()"></label>
            </div>
          </div>
          <table class="table_order">
            <tr>
              <th class="det">   订单详情</th>
              <th class="text-center name">收货人</th>
              <th class="text-center num">金额</th>
              <th class="text-center state">订单状态</th>
              <th class="text-center operate">操作</th>
            </tr>
          </table>
          <div class="tabcon">
            <div class="active">
              {empty name="result"}
              <div class="empty_cart" style="height: 200px;padding-top: 50px;">
                <div>
                  <img src="__STATIC__/img/icon62.png" class="left">
                  <div class="tips left">
                    订单空空的哦~，去看看心仪的商品吧~
                    <a href="{:url('shop/index/index')}" target="_blank">去购物></a>
                  </div>
                </div>
              </div>
              {/empty}
              {volist name="result" id="vo"}
              <div class="order_details">
                <div class="title">
                  <span class="time">{:date('Y-m-d H:i:s',$vo['create_time'])}</span>
                  <span class="order_num">订单号： <span>{$vo.shop_order_number}</span></span>
                  <span class="name_shop">{$vo.shop_title}<img src="__STATIC__/img/icon28.png"></span>
                </div>
                <table border="0">

                  <tr>
                    <td class="det">
                      <img src="/{$vo.thumb_img}" class="pic left">
                      <div class="left goods_det" onclick="jump_goods()">
                        <div class="goods left">
                          <h4>{$vo.title|reStrLen=###,33}</h4>
                        </div>
                        <div class="goods_num left">×{$vo.number}</div>
                      </div>
                    </td>
                    <td class="name text-center">{$vo.address_name}<img src="__STATIC__/img/icon72.png"></td>
                    <td class="num text-center">
                      <div class="num_1">总额￥{$vo.price}</div>
                      <div class="num_2">{$vo.way}</div>
                    </td>
                    {switch name="$vo.status"}
                    {case value="0"}
                    <td class="state text-center">
                      <div class="cancel">等待付款</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <div class="buy"><a href="{:url('payment/index',['order_number'=>$vo.shop_order_number])}"><img src="__STATIC__/img/icon73.png">立即购买</a></div>
                      <div class="buy"><a href="javascript:cancel_order({$vo.id},{$vo.user_id});"><img src="__STATIC__/img/icon73.png">取消订单</a></div>
                    </td>
                    {/case}
                    {case value="1"}
                    <td class="state text-center">
                      <div class="cancel">等待发货</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <div class="buy"><a href="{:url('MemberOrder/return_money',['order'=>$vo.id])}"><img src="__STATIC__/img/icon73.png">申请退款</a></div>
                    </td>
                    {/case}
                    {case value="2"}
                    <td class="state text-center">
                      <div class="cancel">等待收货</div>
                      <div class="details"><a href="javascript:affirm_order({$vo.id},{$vo.user_id});">确认收货</a></div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}" target="_blank">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <div class="buy"><a href="{:url('MemberOrder/logistics',['order_id'=>$vo.id])}" target="_blank"><img src="__STATIC__/img/icon73.png">查看物流</a></div>
                    </td>
                    {/case}
                    {case value="3"}
                    <td class="state text-center">
                      <div class="cancel">待评价</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <div class="buy"><a href="{:url('MemberOrder/evaluate',['aid'=>$vo.aid,'oid'=>$vo.id])}"><img src="__STATIC__/img/icon73.png">立即评价</a></div>
                      <div class="buy"><a href="{:url('MemberOrder/return_cargo',['order'=>$vo.id])}"><img src="__STATIC__/img/icon73.png">申请退货</a></div>
                    </td>
                    {/case}
                    {case value="4"}
                    <td class="state text-center">
                      <div class="cancel">已完结</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <div class="buy"><a href="{:url('ShopGoods/index',['good_id'=>$vo.goods_id])}" target="_blank"><img src="__STATIC__/img/icon73.png">再来一单</a></div>
                    </td>
                    {/case}
                    {case value="5"}
                    <td class="state text-center">
                      <div class="cancel">该订单已取消</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <!--<div class="buy"><a href="{:url('ShopGoods/index',['good_id'=>$vo.id])}" target="_blank"><img src="__STATIC__/img/icon73.png">再来一单</a></div>-->
                    </td>
                    {/case}
                    {case value="6"}
                    <td class="state text-center">
                      <div class="cancel">申请退款中</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <div class="buy"><a href="{$vo.url}" target="_blank"><img src="__STATIC__/img/icon73.png">联系平台</a></div>
                    </td>
                    {/case}
                    {case value="9"}
                    <td class="state text-center">
                      <div class="cancel">退款中</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <div class="buy" style="width: 100px;"><a href="{:url('MemberOrder/return_express',['order'=>$vo.id])}" target="_blank"><img src="__STATIC__/img/icon73.png">填写物流信息</a></div>
                    </td>
                    {/case}
                    {case value="10"}
                    <td class="state text-center">
                      <div class="cancel">退款成功</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <!--<div class="buy"><a href="{:url('ShopGoods/index',['good_id'=>$vo.id])}" target="_blank"><img src="__STATIC__/img/icon73.png">再来一单</a></div>-->
                    </td>
                    {/case}
                    {case value="11"}
                    <td class="state text-center">
                      <div class="cancel">退款失败</div>
                      <div class="details"><a href="{:url('MemberOrder/detail',['order_id'=>$vo.id])}">订单详情</a></div>
                    </td>
                    <td class="operate text-center">
                      <div class="buy" style="width: 100px;"><a href="{:url('MemberOrder/refend',['order'=>$vo.shop_order_number])}" target="_blank"><img src="__STATIC__/img/icon73.png">查看失败原因</a></div>
                    </td>
                    {/case}
                    {/switch}
                  </tr>

                </table>

              </div>
              {/volist}
            </div>
            <div class="pages">{$result->render();}</div>
          </div>
        </div>
        <div class="main_right">
          <div class="like_con">
            <div class="title">猜你喜欢<span>根据你的浏览记录推荐的商品</span></div>
            <ul class="list_like">
              {volist name="guess_like" id="item"}
              <li>
                <a href="{:url('shop/ShopGoods/index',['good_id'=>$item.id])}" target="_blank">
                  <img src="/{$item.thumb_img}" onerror="this.src='__STATIC__/img/232.png'">
                  <div class="goods">{$item.title|reStrLen=###,29}</div>
                  <div class="num">已有<span>{$item.evaluate_number}+</span>条评价</div>
                  <div class="price">￥{$item.price}</div>
                  <div class="buy">立即购买</div>
                </a>
              </li>
              {/volist}
            </ul>
          </div>
        </div>

      </div>
    </div>
  </div>
<script>
  // 取消订单
  function cancel_order(order,shop) {

    $.ajax({
      url:"{:url('shop/member_order/order_cancel')}",
      dataType:'json',
      type:'post',
      data:{'order_id':order,'shop_id':shop},
      success:function (t) {
        if (t.code==200) {
          layer.msg('订单取消成功', {icon: 1});
          location.reload();

        }else {
          layer.msg(t.message);
        }
      }
    })
  }


  // 确认收货
  function affirm_order(order,shop) {
    $.ajax({
      url:"{:url('shop/member_order/order_confirm')}",
      dataType:'json',
      type:'post',
      data:{'order_id':order,'shop_id':shop},
      success:function (t) {
        if (t.code==200) {
          layer.msg('订单确认成功', {icon: 1});
          location.reload();

        }else {
          layer.msg(t.message);
        }
      }
    })

  }

  function search_order() {
    var title = $('#order_name').val();
    var status = "{:input('status')}";
    if (status=='') {
      window.location ="{:url('MemberOrder/index')}?title="+title;
    }else {
      window.location ="{:url('MemberOrder/index')}?status="+status+"&title="+title;
    }

  }
</script>
{include file="public_foot"}